@extends('layouts.admin-iframe-base')


@section('css')
@stop

@section('content')
        <!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        用户管理
        <small>创建用户</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li class="active">首页</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">

    <!-- Your Page Content Here -->

    <div class="row">
        <div class="col-md-6 col-xs-12">
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">添加用户</h3>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                <form class="form-horizontal" id="J-form" action="/admin/user/create-user" method="post">
                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">用户名</label>

                            <div class="col-sm-10">
                                <input name="name" type="text" class="form-control" placeholder="用户名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">密码</label>

                            <div class="col-sm-10">
                                <input name="password" type="password" class="form-control" placeholder="密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">邮箱</label>

                            <div class="col-sm-10">
                                <input name="email" type="email" class="form-control" placeholder="Email">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">手机</label>

                            <div class="col-sm-10">
                                <input name="phone" type="number" class="form-control" placeholder="手机">
                            </div>
                        </div>

                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <button type="submit" class="btn btn-info pull-right">添加</button>
                    </div>
                    <!-- /.box-footer -->
                </form>
            </div>
        </div>
    </div>


</section>
<!-- /.content -->


@stop

@section('js')
    <script>

        $('#J-form').ajaxForm({
            beforeSubmit: function () {
                validator_info_clear($('#J-form'));
            },
            success: function (data) {
                if (data.status == 1) {
                    alert('添加成功！');
                    window.location.href = '/admin/user/index';
                } else {
                    alert(data.error_msg);
                }
            },
            error: function (xhr) {
                validator_info_show($('#J-form'), xhr);
            }
        });


    </script>
@stop